//
// Created by 11510 on 2024/6/23.
//

#ifndef TEXTQUERY_ORQUERY_H
#define TEXTQUERY_ORQUERY_H

#include "BinaryQuery.h"

class OrQuery : public BinaryQuery {
    friend Query operator|(const Query &, const Query &);

    OrQuery(const Query &left, const Query &right) :
            BinaryQuery(left, right, "|") {}

    QueryResult eval(const TextQuery &) const;
};

/**
 * 保护继承?，只能写在这里
 * @param lhs
 * @param rhs
 * @return
 */
inline Query operator|(const Query &lhs, const Query &rhs) {
//    隐式类型转换
    return std::shared_ptr<QueryBase>(new OrQuery(lhs, rhs));
}


#endif //TEXTQUERY_ORQUERY_H
